package com.canbot.u05.activity.presidemode;

import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager;

import com.canbot.u05.utils.ConstUtils;
import com.canbot.u05.utils.StatusBarUtil;


/**
 * Created by zmp on 2017/3/14.
 * 主持任务基类
 */

public class BaseCompereActivity extends Activity {

        @Override
        protected void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                StatusBarUtil.hideStatusbar(this);
                LocalBroadcastManager.getInstance(this)
                        .registerReceiver(broadcastReceiver, intentFilter);
        }

        protected IntentFilter intentFilter = new IntentFilter(ConstUtils.ACTION_COMPERE_EXIT);

        protected BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
                @Override
                public void onReceive(Context context, Intent intent) {
                        finish();
                }
        };

        @Override
        protected void onDestroy() {
                LocalBroadcastManager.getInstance(this)
                        .unregisterReceiver(broadcastReceiver);
                super.onDestroy();
        }
}
